import axios from 'axios'
import { reactive } from 'vue'
export default function useDog() {
  let dogList = reactive([
    { id: 1, url: 'https://images.dog.ceo/breeds/pembroke/n02113023_4373.jpg' }
  ])
  const getDog = async () => {
    try {
      let res = await axios.get(
        'https://dog.ceo/api/breed/pembroke/images/random'
      )
      let url = res.data.message
      dogList.push({ id: dogList.length - 1, url })
      // console.log(url)
      // console.log(res)
    } catch (error) {
      console.log(error)
    }
  }
  return { getDog, dogList }
}
